package com.usian.controller;

import com.usian.pojo.SearchItem;
import com.usian.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class SearchControllerService {

    @Autowired
    private SearchService searchService;

    @RequestMapping("importAll")
    public boolean importAll(){
        return searchService.importAll();
    }

    @RequestMapping("list")
    public List<SearchItem> list(@RequestParam String q, @RequestParam Integer page,
                                 @RequestParam Integer pageSize){
        return searchService.list(q,page,pageSize);
    };
}
